package com.service;

import com.dao.impl.UserDaoImpl;
import com.pojo.User;

public class UserService {

    public boolean register(User user){
        try {
            UserDaoImpl userDao = new UserDaoImpl();
            if(userDao.isUsernameExist(user.getUsername()) || userDao.isEmailExist(user.getEmail())){
                System.out.println("register false1");
                return false;
            }
            userDao.addUser(user);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("register false2");
        return false;
    }
}
